from aip import AipOcr

#车牌识别
#2021-5-7

def get_msg(filePath):
    """ 你的 APPID AK SK """
    APP_ID = '24118842'
    API_KEY = 'nocypE6T3CMy8fWOF12jsizN'
    SECRET_KEY = 'uWeT4yaZsBiBpsg9vvUG8L33qOGrNxg4'
    client = AipOcr(APP_ID, API_KEY, SECRET_KEY)

    """ 读取图片 """
    with open(filePath, 'rb') as fp:
        imag=fp.read()

    """ 如果有可选参数 """
    options = {}
    options["multi_detect"] = "true"

    """ 带参数调用车牌识别 """
    data=client.licensePlate(imag, options)


    result=data["words_result"][0]["number"]
    #print(type(result),result)
    
    return result

if __name__ == "__main__":
    get_msg("../img/1.jpg")
